home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / mordor_2.000 / mordor_2 / src / dm5.c < prev    next >
C/C++ Source or Header  |  1995-03-31  |  18KB  |  734 lines

  1. /*
  2.  * DM5.C:
  3.  *
  4.  *  DM functions
  5.  *
  6.  *  Copyright (C) 1991, 1992, 1993 Brett J. Vickers
  7.  *
  8.  */
  9.  
  10. #include "mstruct.h"
  11. #include "mextern.h"
  12.  
  13. #include <ctype.h>
  14.  
  15. /*******************************************************************/
  16. /*                             dm_replace                          */
  17. /*******************************************************************/
  18. /* The dm_replace command allows a caretaker+ to search and replace *
  19.  * selected word in a rooms description.  If the search word does   *
  20.  * exists, an error is returned.  NOTE: the command format is       *
  21.  * derived by the txt_parse function. The search pattern may only   *
  22.  * one word, while the repalcement pattern may consist of any       *
  23.  * number of characters, spaces, symbols. The line which the        *
  24.  * repalcement occurs, wil not be reformated. */
  25.  
  26. int dm_replace(ply_ptr, cmnd)
  27. creature        *ply_ptr;
  28. cmd             *cmnd;
  29. {
  30.     room    *rom_ptr;
  31.     int     rom, fd, i;
  32.     char    *desc, *pattern, *replace, *tmp;
  33.     char    domain =0;
  34.     int     len1, len2, len3, len4;
  35.     int     value;
  36.  
  37.     rom_ptr = ply_ptr->parent_rom;
  38.     fd = ply_ptr->fd;
  39.  
  40.     if(ply_ptr->class < CARETAKER)
  41.         return(PROMPT);
  42.  
  43.     txt_parse(cmnd->fullstr,&pattern,&value,&replace);
  44.  
  45.  
  46.     if (!pattern || !replace) {
  47.         print(fd,"syntax:*replace <pattern> <replacement>\n");
  48.         return(0);
  49.     }
  50.     domain = 0;
  51.     desc =  rom_ptr->short_desc;
  52.     
  53.  
  54.     len1 = (desc) ? strlen(desc) : 0;
  55.     len2 = (pattern) ? strlen(pattern) : 0;
  56.     len3 = (replace) ? strlen(replace) : 0;
  57.     len4 = len1 + len3 - len2;
  58.  
  59.     i=desc_search(desc, pattern,&value); 
  60.  
  61.     if (i== -1 && value){
  62.         domain = 1;
  63.         desc =  rom_ptr->long_desc;
  64.         i=desc_search(desc, pattern,&value); 
  65.         len1 = (desc) ? strlen(desc) : 0;
  66.         len4 = len1 + len3 - len2;
  67.     }
  68.  
  69.     if(i<0){
  70.         print(fd, "Pattern not found.\n");
  71.         return(0);
  72.     }
  73.  
  74.     tmp = (char *)malloc(len4+1);
  75.     if(!tmp)
  76.            merror("dm_replace", FATAL);     
  77.  
  78.     memcpy(tmp,desc,i);
  79.     memcpy(&tmp[i],replace,len3);
  80.     memcpy(&tmp[i+len3],&desc[i+len2],len1-(i+len2));
  81.     tmp[len4] = 0; 
  82.     
  83.  
  84.     free(desc);
  85.  
  86.     if (domain == 0)
  87.         rom_ptr->short_desc = tmp;
  88.     else
  89.         rom_ptr->long_desc = tmp; 
  90.     
  91.     return(0);
  92. }
  93. /*******************************************************************/
  94. /*                             dm_delete                           */
  95. /*******************************************************************/
  96. /* The dm_pattern command allows a caretaker+ to search and pattern *
  97.  * selected word in a rooms description.  If the search word does   *
  98.  * exists, an error is returned.  NOTE: the command format is       *
  99.  * derived by the txt_parse function. The search flag may only   *
  100.  * one word, while the repalcement flag may consist of any       *
  101.  * number of characters, spaces, symbols. The line which the        *
  102.  * repalcement occurs, wil not be reformated. */
  103.  
  104. int dm_delete(ply_ptr, cmnd)
  105. creature        *ply_ptr;
  106. cmd             *cmnd;
  107. {
  108.     room    *rom_ptr;
  109.     int     rom, fd, i;
  110.     char    *desc, *flag, *pattern, *tmp;
  111.     char    domain =0, dcase = 0;
  112.     int     len1, len2;
  113.     int     value;
  114.  
  115.     rom_ptr = ply_ptr->parent_rom;
  116.     fd = ply_ptr->fd;
  117.  
  118.     if(ply_ptr->class < CARETAKER)
  119.         return(PROMPT);
  120.  
  121.     txt_parse(cmnd->fullstr,&flag,&value,&pattern);
  122.  
  123.     if (!flag) {
  124.         print(fd,"syntax:*delete [-PESLA] <delete_word>\n");
  125.         return(0);
  126.     }
  127.  
  128.     if (flag[0] == '-'){
  129.         if (strlen(flag) > 1)
  130.         switch(flag[1]) {
  131.         case 'S':
  132.         free(rom_ptr->short_desc);
  133.         rom_ptr->short_desc = NULL;
  134.         return (0);
  135.             break;
  136.         case 'L':
  137.         free(rom_ptr->long_desc);
  138.         rom_ptr->long_desc = NULL;
  139.         return (0);
  140.             break;
  141.        case 'A':
  142.         free(rom_ptr->short_desc);
  143.         free(rom_ptr->long_desc);
  144.         rom_ptr->short_desc = rom_ptr->long_desc = NULL;
  145.         return (0);
  146.             break;
  147.        case 'E':
  148.         dcase = 1;
  149.         break;
  150.        case 'P': case 'D':
  151.         dcase = 0;
  152.         if (!pattern){
  153.             print(fd,"syntax:*delete [-PESLA] <delete_word>\n");
  154.             return(0);
  155.         }
  156.         break;
  157.        default:
  158.             print(fd,"syntax:*delete [-PESLA] <delete_word>\n");
  159.             return(0);
  160.         break;
  161.     }
  162.     else {
  163.            print(fd,"syntax:*delete [-PESLA] <delete_word>\n");
  164.            return(0);
  165.     }
  166.     }
  167.     else {
  168.         tmp = flag;
  169.         flag = pattern;
  170.         pattern = tmp;
  171.     }
  172.  
  173.  
  174. /* search for word / phrase */
  175.         domain = 0;
  176.         desc =  rom_ptr->short_desc;
  177.  
  178.         len1 = (desc) ? strlen(desc) : 0;
  179.         len2 = (pattern) ? strlen(pattern) : 0;
  180.  
  181.         i=desc_search(desc, pattern,&value); 
  182.  
  183.         if (i== -1 && value){
  184.             domain = 1;
  185.             desc =  rom_ptr->long_desc;
  186.             i=desc_search(desc, pattern,&value); 
  187.             len1 = (desc) ? strlen(desc) : 0;
  188.         }
  189.  
  190.         if(i<0){
  191.             print(fd, "Pattern not found.\n");
  192.             return(0);
  193.         }
  194.  
  195. /*delete word / phrase */   
  196.     if (dcase == 1){
  197.         tmp = (char *)malloc(i+1);
  198.         if(!tmp)
  199.             merror("dm_delete", FATAL);     
  200.  
  201.         memcpy(tmp,desc,i);
  202.         tmp[i] = 0; 
  203.     }
  204.     else{
  205.         tmp = (char *)malloc(len1-len2+1);
  206.         if(!tmp)
  207.             merror("dm_delete", FATAL);     
  208.  
  209.         memcpy(tmp,desc,i);
  210.         memcpy(&tmp[i],&desc[i+len2],len1-(i+len2));
  211.         tmp[len1-len2] = 0; 
  212.     }
  213.  
  214.         free(desc);
  215.  
  216.         if (domain == 0)
  217.             rom_ptr->short_desc = tmp;
  218.         else
  219.             rom_ptr->long_desc = tmp; 
  220.        
  221.     return(0);
  222. }
  223.  
  224. /**************************************************************/
  225. /*        desc_search                  */
  226. /**************************************************************/
  227.  
  228. /* The desc_search function searches the given string (desc)   *
  229.  * for the given pattern (pattern) and returns the location of *
  230.  * the 'val' occurace of the pattern.  Note: the value of      *
  231.  * 'val' will change to reflect to needed number of matchs.    *
  232.  * This is done to allow to search several realted, but not    *
  233.  * conencted strings for the pattern as if searching 1 string  */
  234.  
  235. int desc_search(desc,pattern,val)
  236. char    *desc;
  237. char    *pattern;
  238. int *val;
  239. {
  240.     int i, j, len, len2;
  241.     char    c, match = 0, found= 0;
  242.  
  243.     if(!desc || !pattern)
  244.         return (-1);
  245.     len = strlen(pattern); 
  246.     len2 = strlen(desc);
  247.     i = 0;
  248.  
  249.     while(i+len <= len2){
  250.     if(memcmp(pattern,&desc[i],len) == 0){
  251.            (*val)--;
  252.            if((*val)==0) {
  253.                 found = 1;
  254.                 break;
  255.             }
  256.           }
  257.         i++;
  258.     }
  259.     if(found)
  260.         return(i);
  261.     else
  262.         return(-1);
  263. }
  264.        
  265. /*==================================================================*/
  266. /*                          txt_parse                               */
  267. /*==================================================================*/
  268. /* txt parse is design to parse a string (str), and return the 2nd  *
  269.  * in the string as the pararmetr pattern, if the 2nd word of the   *
  270.  * is followed by a number, then the number value is assignmed to   *
  271.  * val. The remained of of the string is teh assigned to repalce    *
  272.  * parameter. Note: white spaces inbetween the paraments are not    *
  273.  * counted.  If txt_parse is unable to assign a value to  either of *
  274.  * the char parameters, (due to lack of words), the parameters will *
  275.  * be assigned the null value.*/
  276.  
  277. void txt_parse(str,pattern,val,replace)
  278.         char    *str;
  279.         char    **pattern;
  280.         int     *val;
  281.         char    **replace;
  282.  
  283. {
  284.         int     i,j, index, len;
  285.         char    *tmp;
  286.  
  287. /* remove command */
  288.         len = strlen(str); 
  289.         index = len;
  290.         for(i=0; i < len ; i++)
  291.             if (str[i] == ' ' ){
  292.                     index = i;
  293.                     break;
  294.             }
  295.  
  296.     while (str[index] == ' ')
  297.         index++;
  298.  
  299.  
  300. /*extract search pattern */                
  301.     len = strlen(&str[index]);
  302.     j =  len;
  303.     if(!len)
  304.         *pattern = 0;
  305.     else{
  306.         for(i=0; i < len; i++)
  307.             if (str[i + index] == ' '){
  308.                 j = i;
  309.                 break;
  310.         }
  311.  
  312.         tmp = (char *)malloc(j+1);
  313.     if(!tmp)
  314.            merror("txt_parse", FATAL);  
  315.  
  316.         memcpy(tmp,&str[index],j);
  317.         tmp[j] = 0;
  318.         *pattern = tmp;
  319.         index += j;
  320.     } 
  321.  
  322.     while (str[index] == ' ')
  323.         index++;
  324.  
  325.  
  326. /* check number place of pattern */
  327.     if(isdigit(str[index])){
  328.         *val = atoi(&str[index]);
  329.         if(*val < 1) *val = 1;
  330.         while(isdigit(str[++index]));
  331.         while (str[index] == ' ')
  332.             index++;
  333.         }
  334.     else
  335.         *val = 1;
  336.  
  337.  
  338. /* remaining string = repalcement */ 
  339.     len = strlen(&str[index]);
  340.     if (!len)
  341.         *replace = 0;
  342.     else{
  343.         tmp = (char *)malloc(len+1);
  344.     if(!tmp)
  345.            merror("txt_parse", FATAL);  
  346.         memcpy(tmp,&str[index],len);
  347.         tmp[len] = 0;
  348.         *replace = tmp;
  349.     }
  350.     return;
  351. }       
  352.  
  353. /*==================================================================*/
  354. /*                          dm_nameroom                             */
  355. /*==================================================================*/
  356. int dm_nameroom(ply_ptr, cmnd)
  357. creature        *ply_ptr;
  358. cmd             *cmnd;
  359. {
  360.     int     len,i=0;
  361.     char    *tmp;
  362.     room    *rom_ptr;
  363.  
  364.     rom_ptr = ply_ptr->parent_rom;
  365.  
  366.     if(ply_ptr->class < CARETAKER)
  367.         return(PROMPT);
  368.  
  369.  
  370.     len = strlen(cmnd->fullstr);
  371.  
  372.     while ( i < len){
  373.         if (cmnd->fullstr[i] == ' ' && cmnd->fullstr[i+1] != ' ') 
  374.           break;
  375.         i++;
  376.     }
  377.     
  378.     len = strlen(&cmnd->fullstr[i+1]); 
  379.     if (!len) {
  380.                 print(ply_ptr->fd, "Rename room to what?\n");
  381.                 return(0);
  382.     }
  383.  
  384.     if (len>79) {
  385.                 print(ply_ptr->fd, "Room name too long.\n");
  386.                 return(0);
  387.     }
  388.         
  389.  
  390.     memcpy(rom_ptr->name,&cmnd->fullstr[i+1],len);
  391.     rom_ptr->name[len] = 0;
  392.     return(0);
  393.  
  394. }
  395.  
  396. /*==================================================================*/
  397.  
  398. /*==================================================================*/
  399. /* The dm_append command allows a DM to append a text line onto   *
  400.  * a rooms's description.  The default is a new line appended to  *
  401.  * the end of the long text description. The user can select to   *
  402.  * to append to the short descroption (-s) or the end of the      *
  403.  * with no new line (-n) or both (-ns) */
  404.  
  405. int dm_append(ply_ptr, cmnd)
  406. creature        *ply_ptr;
  407. cmd             *cmnd;
  408. {
  409.     int    len, len2, i =0;
  410.     int    fd;
  411.     room   *rom_ptr;
  412.     char   *buf, *desc, nnl = 0, ds = 0;
  413.  
  414.     rom_ptr = ply_ptr->parent_rom;
  415.     fd = ply_ptr->fd;
  416.  
  417.     if(ply_ptr->class < CARETAKER)
  418.         return(PROMPT);
  419.  
  420.     len = strlen(cmnd->fullstr);
  421.     while (i < len){
  422.         if (cmnd->fullstr[i] == ' ' && cmnd->fullstr[i+1] != ' ')
  423.             break;
  424.         i++;
  425.     }
  426.     i++;
  427.  
  428.    if (i >= len){
  429.         print(fd,"syntax: *append [-sn] <text>\n");
  430.     return(0);
  431.     }
  432.  
  433.     if (cmnd->fullstr[i]  == '-'){
  434.         if (strlen(&cmnd->fullstr[i]) < 4){
  435.             print(fd,"syntax: *append [-sn] <text>\n");
  436.             return(0);
  437.         }
  438.         i++;
  439.  
  440.         if (cmnd->fullstr[i] == 's'){
  441.             ds =1; 
  442.             if (cmnd->fullstr[i+1] == 'n')
  443.                 nnl = 1;
  444.         }
  445.         else if (cmnd->fullstr[i] == 'n'){
  446.             nnl = 1;
  447.             if (cmnd->fullstr[i+1] == 's')
  448.                ds =1; 
  449.         }
  450.  
  451.        while(i < len){
  452.            if (nnl && cmnd->fullstr[i] == ' ')
  453.                 break;
  454.            if (cmnd->fullstr[i] == ' ' && cmnd->fullstr[i+1] != ' ')
  455.                break;
  456.             i++;
  457.        }
  458.        i++;
  459.        if (i >= len){
  460.            print(fd,"syntax: *append [-sn] <text>\n");
  461.            return(0);
  462.        }
  463.     }
  464.  
  465.     if (ds){
  466.         desc = rom_ptr->short_desc;
  467.         if (!rom_ptr->short_desc)
  468.             nnl = 1;
  469.     }
  470.     else{
  471.         desc = rom_ptr->long_desc;
  472.         if (!rom_ptr->long_desc)
  473.             nnl = 1;
  474.     }
  475.  
  476.  
  477.     len = (&cmnd->fullstr[i]) ? strlen(&cmnd->fullstr[i]) : 0;
  478.     len2 =  (desc) ?  strlen(desc) : 0;
  479.  
  480.     if (nnl) {
  481.         buf  = (char *)malloc(len2 + len+1);
  482.         memcpy(buf,desc,len2);
  483.         memcpy(&buf[len2],&cmnd->fullstr[i],len);
  484.         buf[len+len2] = 0;
  485.     }
  486.     else {
  487.         buf  = (char *)malloc(len2 + len+2);
  488.         memcpy(buf,desc,len2);
  489.         buf[len2] = '\n';
  490.         memcpy(&buf[len2+1],&cmnd->fullstr[i],len);
  491.         buf[len+len2+1] = 0;
  492.     }
  493.  
  494.     free(desc);
  495.     if (ds)
  496.         rom_ptr->short_desc = buf;
  497.     else
  498.         rom_ptr->long_desc = buf;
  499.     return(0);
  500. }
  501. /*==================================================================*/
  502.  
  503. /*==================================================================*/
  504. /* The dm_prepend command allows a DM to prepend a text line onto   *
  505.  * a rooms's description.  The default is a new line prepend to  *
  506.  * the end of the long text description. The user can select to   *
  507.  * to prepend to the short descroption (-s) or the end of the      *
  508.  * with no new line (-n) or both (-ns) */
  509.  
  510. int dm_prepend(ply_ptr, cmnd)
  511. creature        *ply_ptr;
  512. cmd             *cmnd;
  513. {
  514.     int    len, len2, i =0;
  515.     int    fd;
  516.     room   *rom_ptr;
  517.     char   *buf, *desc, nnl = 0, ds = 0;
  518.  
  519.     rom_ptr = ply_ptr->parent_rom;
  520.     fd = ply_ptr->fd;
  521.  
  522.     if(ply_ptr->class < CARETAKER)
  523.         return(PROMPT);
  524.  
  525.     len = strlen(cmnd->fullstr);
  526.     while (i < len){
  527.         if (cmnd->fullstr[i] == ' ' && cmnd->fullstr[i+1] != ' ')
  528.             break;
  529.         i++;
  530.     }
  531.     i++;
  532.  
  533.    if (i >= len){
  534.         print(fd,"syntax: *prepend [-sn] <text>\n");
  535.     return(0);
  536.     }
  537.  
  538.     if (cmnd->fullstr[i]  == '-'){
  539.         if (strlen(&cmnd->fullstr[i]) < 4){
  540.             print(fd,"syntax: *prepend [-sn] <text>\n");
  541.             return(0);
  542.         }
  543.         i++;
  544.  
  545.         if (cmnd->fullstr[i] == 's'){
  546.             ds =1; 
  547.             if (cmnd->fullstr[i+1] == 'n')
  548.                 nnl = 1;
  549.         }
  550.         else if (cmnd->fullstr[i] == 'n'){
  551.             nnl = 1;
  552.             if (cmnd->fullstr[i+1] == 's')
  553.                ds =1; 
  554.         }
  555.  
  556.        while(i < len){
  557.            if (cmnd->fullstr[i] == ' ' && cmnd->fullstr[i+1] != ' ')
  558.                break;
  559.             i++;
  560.        }
  561.        i++;
  562.        if (i >= len){
  563.            print(fd,"syntax: *prepend [-sn] <text>\n");
  564.            return(0);
  565.        }
  566.     }
  567.  
  568.     if (ds){
  569.         desc = rom_ptr->short_desc;
  570.         if (!rom_ptr->short_desc)
  571.             nnl = 1;
  572.     }
  573.     else{
  574.         desc = rom_ptr->long_desc;
  575.         if (!rom_ptr->long_desc)
  576.             nnl = 1;
  577.     }
  578.  
  579.  
  580.     len = (&cmnd->fullstr[i]) ? strlen(&cmnd->fullstr[i]) : 0;
  581.     len2 =  (desc) ?  strlen(desc) : 0;
  582.  
  583.     if (nnl) {
  584.         buf  = (char *)malloc(len2 + len+1);
  585.         memcpy(buf,&cmnd->fullstr[i],len);
  586.         memcpy(&buf[len],desc,len2);
  587.         buf[len+len2] = 0;
  588.     }
  589.     else {
  590.         buf  = (char *)malloc(len2 + len+2);
  591.         memcpy(buf,&cmnd->fullstr[i],len);
  592.         buf[len] = '\n';
  593.         memcpy(&buf[len+1],desc,len2);
  594.         buf[len+len2+1] = 0;
  595.     }
  596.  
  597.     free(desc);
  598.     if (ds)
  599.         rom_ptr->short_desc = buf;
  600.     else
  601.         rom_ptr->long_desc = buf;
  602.     return(0);
  603. }
  604.  
  605.  
  606. /**********************************************************************/
  607. /*                dm_help                      */
  608. /**********************************************************************/
  609. /* This function allows a DM to obtain a list of flags for rooms, exits, */
  610. /* monsters, players and objects.                                        */
  611.  
  612. int dm_help(ply_ptr, cmnd)
  613. creature    *ply_ptr;
  614. cmd        *cmnd;
  615. {
  616.     char     file[80];
  617.     int    fd, c=0, match=0, num=0;
  618.     
  619.     fd = ply_ptr->fd;
  620.  
  621.     if (ply_ptr->class < CARETAKER){
  622.         return(0);
  623.     }
  624.  
  625.     strcpy(file, DOCPATH);
  626.  
  627.     if(cmnd->num < 2) {
  628.         strcat(file, "/dm_helpfile");
  629.         view_file(fd, 1, file);
  630.         return(DOPROMPT);
  631.     }
  632.  
  633.     if(!strcmp(cmnd->str[1], "mflags")) {
  634.         strcat(file, "/mflags");
  635.         view_file(fd, 1, file);
  636.         return(DOPROMPT);
  637.     }
  638.  
  639.     else if(!strcmp(cmnd->str[1], "oflags")) {
  640.         strcat(file, "/oflags");
  641.         view_file(fd, 1, file);
  642.         return(DOPROMPT);
  643.     }
  644.  
  645.     else if(!strcmp(cmnd->str[1], "pflags")) {
  646.         strcat(file, "/pflags");
  647.         view_file(fd, 1, file);
  648.         return(DOPROMPT);
  649.     }
  650.     
  651.     else if(!strcmp(cmnd->str[1], "rflags")) {
  652.         strcat(file, "/rflags");
  653.         view_file(fd, 1, file);
  654.         return(DOPROMPT);
  655.     }
  656.  
  657.     else if(!strcmp(cmnd->str[1], "xflags")) {
  658.         strcat(file, "/xflags");
  659.         view_file(fd, 1, file);
  660.         return(DOPROMPT);
  661.     }
  662.  
  663.     else if(!strcmp(cmnd->str[1], "sflags")) {
  664.         strcat(file, "/sflags");
  665.         view_file(fd, 1, file);
  666.         return(DOPROMPT);
  667.     }
  668.  
  669.     else if(!strcmp(cmnd->str[1], "titles")) {          
  670.         strcat(file, "/titles");                   
  671.         view_file(fd, 1, file);                    
  672.         return(DOPROMPT);                          
  673.     }                                                  
  674.  
  675.     else if(!strcmp(cmnd->str[1], "oset")) {
  676.         strcat(file, "/oset");
  677.         view_file(fd, 1, file);
  678.         return(DOPROMPT);
  679.     }
  680.  
  681.     else if(!strcmp(cmnd->str[1], "pset")) {
  682.         strcat(file, "/pset");
  683.         view_file(fd, 1, file);
  684.         return(DOPROMPT);
  685.     }
  686.  
  687.     else if(!strcmp(cmnd->str[1], "char")) {
  688.         strcat(file, "/char");
  689.         view_file(fd, 1, file);
  690.         return(DOPROMPT);
  691.     }
  692.  
  693.     else if(!strcmp(cmnd->str[1], "wear")) {
  694.         strcat(file, "/wear");
  695.         view_file(fd, 1, file);
  696.         return(DOPROMPT);
  697.     }
  698.  
  699.     else if(!strcmp(cmnd->str[1], "otypes")) {
  700.         strcat(file, "/otypes");
  701.         view_file(fd, 1, file);
  702.         return(DOPROMPT);
  703.     }
  704.  
  705.     else if(!strcmp(cmnd->str[1], "realms")) {
  706.         strcat(file, "/realms");
  707.         view_file(fd, 1, file);
  708.         return(DOPROMPT);
  709.     }
  710.  
  711.     else if(!strcmp(cmnd->str[1], "exp")) {
  712.         strcat(file, "/exp");
  713.         view_file(fd, 1, file);
  714.         return(DOPROMPT);
  715.     }
  716.  
  717.     else if(!strcmp(cmnd->str[1], "scrolls")) {
  718.         strcat(file, "/scrolls");
  719.         view_file(fd, 1, file);
  720.         return(DOPROMPT);
  721.     }
  722.  
  723.     else if(!strcmp(cmnd->str[1], "star")) {
  724.         strcat(file, "/star");
  725.         view_file(fd, 1, file);
  726.         return(DOPROMPT);
  727.     }
  728.  
  729.     else {
  730.         print(fd,"That dm help file does not exist.\n");
  731.         return(0);
  732.     }
  733. }
  734.